using PKGames.Utils;

namespace PKGames.Analytics
{
	public class PlayGameEvent : AnalyticsEvent
	{
		private const int EventVersion = 1;

		private const string EventName = "play_game";

		private const string OriginKey = "origin";

		private const string GameNameKey = "name";

		private const string LevelNameKey = "level";

		private const string ConnectionKey = "connectionType";

		private const string TimeUsageKey = "timeUsage";

		protected override int Flags => 3;

		protected override string Name => "play_game";

		protected override int Revision => 1;

		public PlayGameEvent(string origin, string gameName, string gameLevel)
		{
			base.Parameters["origin"] = new UnityEncodedPrimitiveData(origin);
			base.Parameters["name"] = new UnityEncodedPrimitiveData(gameName);
			base.Parameters["level"] = new UnityEncodedPrimitiveData(gameLevel);
		}

		public void SetTimeUsage(float timeUsage)
		{
			base.Parameters["timeUsage"] = new UnityEncodedPrimitiveData(timeUsage);
		}

		public override void Finish()
		{
			base.Parameters["connectionType"] = new UnityEncodedPrimitiveData(ConnectivityUtils.GetConnectivityStatus());
		}
	}
}
